<include file="App/Home/View/default/Public/header.html"/>
  <link href="__PUBLIC__/css/create_drawer.css" rel="stylesheet" media="screen">
  <link href="__PUBLIC__/Multicuploads/uploadify.css" rel="stylesheet" media="screen">

  <div class="container">
    <div class="row">
      <div class="col-md-8 col-md-offset-2">
        <form id="J_CreateDrawerForm" method="post" action="{:U('drawer/create_drawer')}" class="StaticForm">
            <input type="hidden" name="id" value="">
            <h3>
            创建抽屉<!-- /编辑抽屉 /&nbsp;<a href="javascript:;">sssss</a> -->
            </h3>
            <ul>
                <li>
                    <label for="id_title">起个好名吧</label>
                    <div class="Right">
                        <input id="title" name="title" class="clear-input">
                    </div>
                </li>
                <li>
                    <label for="id_description">好的描述让人印象深刻</label>
                    <div class="Right">
                        <textarea id="id_description" rows="3" cols="40" name="intro" class="clear-input"></textarea>
                    </div>
                </li>
                <li>
                    <label>选择分类能让大家更容易找到哦</label>
                    <div class="Right">
                        <input type="hidden" name="category_id" id="id_category" value="" class="clear-input">
                        <div class="BoardListOverlay"></div>
                        <div data="" class="BoardSelector BoardPicker CategoryPicker">
                            <div class="current"><span class="CurrentBoard">选择分类</span><span class="DownArrow"></span></div>
                            <div class="BoardList" style="display:none;">
                                <div class="BoardListBody">
                                    <ul>
                                        <li class="BoardCategory" data="design"><span>平面</span></li>
                                        <li class="BoardCategory" data="funny"><span>搞笑</span></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </li>
                <li class="Delete">
                    <label>封面，好的封面让人欲罢不能</label>
                    <div class="Right">
                        <input type="file" id="file_upload" name="drawer_cover"/>
                    </div>
                    <div class="Right image-preview-box" style="margin-left:150px;">
                        <img width="100" height="100" src="__PUBLIC__/images/drawer-default-small.jpg" alt="默认封面" title="默认封面">
                    </div>
                    <input type="hidden" name="cover" id="cover">
                </li>
                <!-- <li class="Delete">
                    <label>删除，真的不要伦家了么</label><a data-url="/iemu6lzvqm/" href="#" onclick="return false;" class="btn-del btn btn18 wbtn"><strong> 删除画板</strong><span></span></a>
                </li> -->
            </ul>
            <div class="Submit">
              <a href="#" onclick="return false;" class="editpage_submit btn btn24 rbtn J_Save"><strong> 保存设置</strong><span></span>
              </a>
            </div>
        </form>
      </div>
      <div class="col-md-4">
        
      </div>
    </div>
  </div>

<script src="__PUBLIC__/Multicuploads/jquery.uploadify.min.js" type="text/javascript"></script>
<script type="text/javascript">
    <?php $timestamp = time(); ?>
    var uploadPath = '__ROOT__/Public/Uploads/';
    $(function() {
    	$('.current').click(function() {
    		$('.BoardList').css('display', 'block');
    	});

    	//点击效果
    	$('.BoardCategory').click(function() {
    		$('.CurrentBoard').text($(this).find('span').text());
    		$('.CurrentBoard').attr('data', $(this).attr('data'));
    		$('#id_category').val($(this).attr('data'));
    		$('.BoardList').css('display', 'none');
    	});

        $('.J_Save').click(function() {
          $('#J_CreateDrawerForm').trigger('submit');
        });

        //数据验证
        $('#J_CreateDrawerForm').submit(function() {
          var title = $('input[name="title"]').val();
          if (!$.trim(title)) { 
            alert('标题必须填写');
            return false;
          };
        });

        $('#file_upload').uploadify({
            //formData用于传递一些数据到后台
            'formData'     : {
                
            },
            'swf'      : '__PUBLIC__/Multicuploads/uploadify.swf',
            'width'    : 120,
            'height'   : 30,
            'buttonImage': '__PUBLIC__/Multicuploads/browse-btn.png',
            'uploader' : '{:U('Drawer/upload_cover')}',
            'method'   : 'post',
            'buttonText':'选择图片',
            'progressData':'percentage',
            'removeCompleted':false,
            'onUploadSuccess' : function(file, data) {
                  var coverPath = uploadPath + data;
                  
                  $('.image-preview-box').find('img').attr('src', coverPath);
                  $('#cover').val(data);

                },
            'onQueueComplete':function(){
                
              }
        });
    });
</script>
<include file="App/Home/View/default/Public/footer.html"/>